package com.fs.service.impl;

import com.fs.entity.Materialcategory;
import com.fs.mapper.MaterialcategoryMapper;
import com.fs.service.IMaterialcategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2024-06-12
 */
@Service
public class MaterialcategoryServiceImpl  implements IMaterialcategoryService {
    @Autowired
    MaterialcategoryMapper materialcategoryMapper;
    @Override
    public List<Materialcategory> getKind(int mckind) {
        List<Materialcategory> materialcategories = materialcategoryMapper.selectByMckind(mckind);
        for (Materialcategory materialcategory : materialcategories){
            materialcategory.setLevels(Arrays.asList(materialcategory.getMlevel().split("/")));
            materialcategory.setCredits(Arrays.asList(materialcategory.getMcredit().split(";")));
        }
        return materialcategories;
    }
}
